package com.imu.purse.modules.app.dao;

import com.imu.core.base.BaseMapper;
import com.imu.purse.modules.app.entity.SdZblogEntity;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * @author sunhongwei
 * @email sunhongwei@jshijian.com
 * @date 2018-07-05 19:22:35
 * Copyright (c) 2017 武汉极时间科技有限公司 版权所有 
 * Jshijian aloha CO.,LTD. All Rights Reserved. 
 */
public interface SdZblogMapper extends BaseMapper<SdZblogEntity>
{
	/**
     * 分页查询
     * @return
     */
	@Select({
		"<script>",
		    "SELECT s.id,",
					"s.pay_phone, ",
					"s.bid, ",
					"s.tid, ",
					"s.ptid, ",
					"s.logtime, ",
					"s.num/100 as num, ",
					"s.znum/100 as znum, ",
					"s.rmb/100 as rmb, ",
					"s.rec_phone, ",
					"s.dizi, ",
					"s.status, ",
					"s.txid",
		    "FROM sd_zblog_transform  s where 1=1",
			"<when test='payPhone != null and payPhone !=\"\"'>",
				"AND pay_phone = #{payPhone}",
			"</when>",
			"<when test='recPhone != null and recPhone !=\"\"'>",
				"AND rec_phone = #{recPhone}",
			"</when>",
			"<when test = 'bid != null and bid != \"\"'>",
		    	"AND `bid` = #{bid}",
		    "</when>",
			"<when test = 'tid != null'>",
		    	"AND `tid` = #{tid}",
		    "</when>",
			"<when test = 'ptid != null'>",
		    	"AND `ptid` = #{ptid}",
		    "</when>",
			"<when test = 'stime != null'>",
		    	"AND `logtime` &gt;= #{stime}",
		    "</when>",
			"<when test = 'etime != null'>",
				"AND `logtime` &lt;= #{etime}",
			"</when>",
			"<when test = 'num != null'>",
		    	"AND `num` = #{num}",
		    "</when>",
			"<when test = 'znum != null'>",
		    	"AND `znum` = #{znum}",
		    "</when>",
			"<when test = 'rmb != null'>",
		    	"AND `rmb` = #{rmb}",
		    "</when>",
			"<when test = 'dizi != null'>",
		    	"AND `dizi` = #{dizi}",
		    "</when>",
			"<when test = 'status != null'>",
		    	"AND `status` = #{status}",
		    "</when>",
			"<when test = 'txid != null'>",
		    	"AND `txid` = #{txid}",
		    "</when>",
		    "ORDER BY logtime DESC",
    	"</script>"
	})
    public List<SdZblogEntity> findByPage(final SdZblogEntity entity);	
}
